require "test/unit"
class Test_Koans<Test::Unit::TestCase
  def test_nil_is_an_object
    assert_equal true, nil.is_a?(Object),"Unlike NULL in other languages" 
  end

  def test_you_dont_get_null_pointer_errors_when_calling_methods_on_nil
    
    begin
      nil.some_method_nil_doesnt_know_about
    rescue Exception => ex
      # What exception has been caught?
      assert_equal NoMethodError, ex.class
      # What message was attached to the exception?
      #(HINT: replace_with part of the error message.)
      assert_match(/nil/,ex.message)
    end
  end

  def test_nil_has_a_few_methods_defined_on_it
    assert_equal true, nil.nil?   #用来判断真假
    assert_equal "", nil.to_s      #to_s用来返回一个字符串
    assert_equal "nil", nil.inspect  #.inspect 返回一个值
  end
end
